﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.ModularFixture.CUiMFFixtureDesignerApplicationDlg
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using EMPMODELLib;
using EMPTYPELIBRARYLib;
using EngineeringInternalExtension;
using System;
using System.Collections;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Drawing;
using System.IO;
using System.Resources;
using System.Windows.Forms;
using Tecnomatix.Engineering;
using Tecnomatix.Engineering.Ui;
using Tecnomatix.Planning;


namespace DnProcessSimulateCommands.ModularFixture;

public class CUiMFFixtureDesignerApplicationDlg : TxForm
{
  private const string PLP_TYPE = "PmPLP";
  private const string CONFIGURATION_TYPE = "ModFix_ConfigurationType";
  private const string LOCATING_POINT_ATTR_NAME = "LocatingPoint";
  private bool isValidFrameSet;
  private CApMFFixtureDesignerApplication m_fixtureApp;
  private ArrayList m_solutions;
  private bool m_validSolutions;
  private bool m_isOpened;
  private TxCompoundResource m_currentTargetResource;
  private TxTransformation m_fixtureUnitOffset;
  private TxTransformation m_fixtureUnitPreviousLocation;
  private bool m_fixtureUnitMoved;
  private ITxObject m_locatingObject;
  private ArrayList m_searchConditionsContained;
  private ArrayList m_searchConditionsNotContained;
  private CApMFFixtureConfigrationValidator m_configValidator;
  private IContainer components;
  private Button m_closeButton;
  private Label m_fixtureUnitUpdateLabel;
  private ListView m_variationListCtrl;
  private ColumnHeader m_variationColumnHeader;
  private ColumnHeader m_distanceColumnHeader;
  private Label m_targetResourceCreateLabel;
  private Label m_configurationCreateLabel;
  private Label m_referenceLabel;
  private RadioButton m_plpRadioButton;
  private RadioButton m_frameRadioButton;
  private Button m_createButton;
  private TabControl m_tabControl;
  private TabPage tabPage1;
  private TabPage tabPage2;
  private TabPage tabPage3;
  private Label m_targetResourceUpdateLabel;
  private Label m_fixtureBaseLabel;
  private Label m_solutionsNumberLabel;
  private NumericUpDown m_solutionsNumericUpDown;
  private Button m_calculateButton;
  private Button m_updateUnitButton;
  private Label m_fixtureUnitReplaceLabel;
  private Label m_targetResourceReplaceLabel;
  private Label m_configurationReplaceLabel;
  private Button m_applyButton;
  private TxObjEditBoxCtrl m_targetResourceCreateEditBox;
  private TxObjEditBoxCtrl m_targetResourceUpdateEditBox;
  private TxObjEditBoxCtrl m_targetResourceReplaceEditBox;
  private TxObjComboBoxCtrl m_fixtureUnitUpdateComboBox;
  private TxObjEditBoxCtrl m_fixtureUnitReplaceEditBox;
  private TxObjEditBoxCtrl m_plpEditBox;
  private TxObjComboBoxCtrl m_fixtureBaseUpdateComboBox;
  private TxObjEditBoxCtrl m_configurationCreateEditBox;
  private TxObjEditBoxCtrl m_configurationReplaceEditBox;
  private Label label1;
  private ComboBox m_typeComboBox;
  private TxFrameEditBoxCtrl m_frameEditBox;
  private Button m_searchConstraints;
  private ToolTip m_toolTip1;
  private Button m_restorePosition;

  public CUiMFFixtureDesignerApplicationDlg()
  {
    this.m_fixtureApp = new CApMFFixtureDesignerApplication();
    this.isValidFrameSet = false;
    this.InitializeComponent();
    this.m_fixtureUnitOffset = new TxTransformation();
    this.m_searchConditionsContained = new ArrayList();
    this.m_searchConditionsNotContained = new ArrayList();
  }

  public virtual void OnInitTxForm()
  {
    TxPickProvider[] txPickProviderArray = new TxPickProvider[2]
    {
      (TxPickProvider) 4,
      (TxPickProvider) 6
    };
    this.m_configurationCreateEditBox.SetPickProviders(txPickProviderArray);
    this.m_configurationReplaceEditBox.SetPickProviders(txPickProviderArray);
    TxTypeFilter txTypeFilter = new TxTypeFilter(typeof (TxPlanningResource));
    txTypeFilter.AddIncludedType(typeof (TxPlanningObject));
    txTypeFilter.AddExcludedType(typeof (TxPlanningPart));
    txTypeFilter.AddExcludedType(typeof (TxPlanningProcessResource));
    txTypeFilter.AddExcludedType(typeof (TxPlanningToolPrototypeAssignment));
    this.m_configurationCreateEditBox.SetValidator((ITxValidator) new TxPlanningTypeFilterValidator((ITxTypeFilter) txTypeFilter, "Invalid object", "Missing object"));
    this.m_configurationCreateEditBox.ListenToPick = true;
    this.m_targetResourceCreateEditBox.ListenToPick = true;
    this.m_fixtureUnitUpdateComboBox.ListenToPick = true;
    this.m_fixtureBaseUpdateComboBox.ListenToPick = true;
    this.m_targetResourceUpdateEditBox.ListenToPick = true;
    this.m_configurationReplaceEditBox.ListenToPick = true;
    this.m_targetResourceReplaceEditBox.ListenToPick = true;
    this.m_fixtureUnitReplaceEditBox.ListenToPick = true;
    TxTypeFilterValidator typeFilterValidator = new TxTypeFilterValidator((ITxTypeFilter) new TxTypeFilter(typeof (TxCompoundResource)), "Invalid object", "Missing object");
    this.m_targetResourceCreateEditBox.SetValidator((ITxValidator) typeFilterValidator);
    this.m_targetResourceUpdateEditBox.SetValidator((ITxValidator) typeFilterValidator);
    this.m_targetResourceReplaceEditBox.SetValidator((ITxValidator) typeFilterValidator);
    this.m_fixtureBaseUpdateComboBox.SetValidator((ITxValidator) new CApMFFixtureBaseValidator());
    this.m_fixtureUnitUpdateComboBox.SetValidator((ITxValidator) new CApMFFixtureUnitValidator(false));
    this.m_fixtureUnitReplaceEditBox.SetValidator((ITxValidator) new CApMFFixtureUnitValidator(true));
    this.m_configValidator = new CApMFFixtureConfigrationValidator();
    this.m_configurationReplaceEditBox.SetValidator((ITxValidator) this.m_configValidator);
    this.m_updateUnitButton.Enabled = false;
    this.m_calculateButton.Enabled = false;
    this.m_restorePosition.Enabled = false;
    this.m_createButton.Enabled = false;
    this.m_applyButton.Enabled = false;
    this.m_solutionsNumericUpDown.Value = 100M;
    this.m_plpEditBox.Enabled = true;
    this.m_plpEditBox.ListenToPick = true;
    this.m_frameEditBox.Enabled = false;
    this.m_typeComboBox.Items.Add((object) "Basic Unit Structure");
    this.m_typeComboBox.Items.Add((object) "Fixture Base");
    this.m_typeComboBox.SelectedIndex = 0;
    this.m_targetResourceCreateEditBox.ListenToPick = true;
    this.m_targetResourceCreateEditBox.Focus();
  }

  private void CUiFixtureDesignerApplicationDlg_Load(object sender, EventArgs e)
  {
    this.m_isOpened = true;
    ResourceManager resourceManager = new ResourceManager("DnProcessSimulateCommands.ModularFixture.FixtureDesigner.Res.StringTable", ((object) this).GetType().Assembly);
    this.m_toolTip1.SetToolTip((Control) this.m_searchConstraints, resourceManager.GetString("SEARCH_CONDITIONS_TOOLTIP"));
    this.m_toolTip1.SetToolTip((Control) this.m_restorePosition, resourceManager.GetString("RESTORE_POSITION_TOOLTIP"));
  }

  private void CUiFixtureDesignerApplicationDlg_FormClosing(object sender, FormClosingEventArgs e)
  {
    this.m_targetResourceCreateEditBox.LoseFocus();
    this.m_targetResourceUpdateEditBox.LoseFocus();
    this.m_targetResourceReplaceEditBox.LoseFocus();
    this.m_configurationCreateEditBox.LoseFocus();
    this.m_configurationReplaceEditBox.LoseFocus();
    this.m_fixtureUnitUpdateComboBox.LoseFocus();
    this.m_fixtureUnitReplaceEditBox.LoseFocus();
    this.m_fixtureBaseUpdateComboBox.LoseFocus();
    this.m_plpEditBox.LoseFocus();
    this.m_fixtureApp.DeleteFrame();
    this.m_isOpened = false;
  }

  private void m_tabControl_SelectedIndexChanged(object sender, EventArgs e)
  {
    switch (this.m_tabControl.SelectedIndex)
    {
      case 0:
        if (this.m_targetResourceUpdateEditBox.Object != null)
        {
          ((Control) this.m_targetResourceCreateEditBox).Text = ((Control) this.m_targetResourceUpdateEditBox).Text;
          this.m_targetResourceCreateEditBox.Object = this.m_targetResourceUpdateEditBox.Object;
        }
        else
        {
          ((Control) this.m_targetResourceCreateEditBox).Text = "";
          this.m_targetResourceCreateEditBox.Object = (ITxObject) null;
        }
        this.ClearUpdateTabFields();
        this.ClearReplaceTabFields();
        this.m_targetResourceCreateEditBox.Focus();
        break;
      case 1:
        if (this.m_targetResourceCreateEditBox.Object != null)
        {
          ((Control) this.m_targetResourceUpdateEditBox).Text = ((Control) this.m_targetResourceCreateEditBox).Text;
          this.m_targetResourceUpdateEditBox.Object = this.m_targetResourceCreateEditBox.Object;
          if (this.m_targetResourceUpdateEditBox.Object != null && TxCompoundResource.op_Inequality(this.m_targetResourceUpdateEditBox.Object as TxCompoundResource, (ITxObject) null))
            this.PopulateFixtureUnitBaseLists();
        }
        this.ClearCreateTabFields();
        this.ClearReplaceTabFields();
        this.UpdateCalculateButtonState();
        this.m_targetResourceUpdateEditBox.Focus();
        break;
      case 2:
        this.ClearCreateTabFields();
        this.ClearUpdateTabFields();
        this.m_fixtureUnitReplaceEditBox.Focus();
        break;
    }
    this.m_fixtureApp.DeleteFrame();
  }

  private void ClearCreateTabFields()
  {
    this.m_targetResourceCreateEditBox.Object = (ITxObject) null;
    ((Control) this.m_targetResourceCreateEditBox).Text = "";
    this.m_targetResourceCreateEditBox.HideErrorWindow();
    this.m_targetResourceCreateEditBox.LoseFocus();
    this.m_configurationCreateEditBox.Object = (ITxObject) null;
    ((Control) this.m_configurationCreateEditBox).Text = "";
    this.m_configurationCreateEditBox.HideErrorWindow();
    this.m_configurationCreateEditBox.LoseFocus();
  }

  private void ClearUpdateTabFields()
  {
    this.m_targetResourceUpdateEditBox.Object = (ITxObject) null;
    ((Control) this.m_targetResourceUpdateEditBox).Text = "";
    this.m_targetResourceUpdateEditBox.HideErrorWindow();
    this.m_targetResourceUpdateEditBox.LoseFocus();
    this.m_fixtureUnitUpdateComboBox.Clear();
    this.m_fixtureUnitUpdateComboBox.Object = (ITxObject) null;
    ((Control) this.m_fixtureUnitUpdateComboBox).Text = "";
    this.m_fixtureUnitUpdateComboBox.HideErrorWindow();
    this.m_fixtureUnitUpdateComboBox.LoseFocus();
    this.m_fixtureBaseUpdateComboBox.Clear();
    this.m_fixtureBaseUpdateComboBox.Object = (ITxObject) null;
    ((Control) this.m_fixtureBaseUpdateComboBox).Text = "";
    this.m_fixtureBaseUpdateComboBox.HideErrorWindow();
    this.m_fixtureBaseUpdateComboBox.LoseFocus();
    this.m_variationListCtrl.Items.Clear();
    if (this.m_solutions == null)
      return;
    this.m_solutions.Clear();
  }

  private void ClearReplaceTabFields()
  {
    this.m_targetResourceReplaceEditBox.Object = (ITxObject) null;
    ((Control) this.m_targetResourceReplaceEditBox).Text = "";
    this.m_targetResourceReplaceEditBox.HideErrorWindow();
    this.m_targetResourceReplaceEditBox.LoseFocus();
    this.m_fixtureUnitReplaceEditBox.Object = (ITxObject) null;
    ((Control) this.m_fixtureUnitReplaceEditBox).Text = "";
    this.m_fixtureUnitReplaceEditBox.HideErrorWindow();
    this.m_fixtureUnitReplaceEditBox.LoseFocus();
    this.m_configurationReplaceEditBox.Object = (ITxObject) null;
    ((Control) this.m_configurationReplaceEditBox).Text = "";
    this.m_configurationReplaceEditBox.HideErrorWindow();
    this.m_configurationReplaceEditBox.LoseFocus();
  }

  private void m_closeButton_Click(object sender, EventArgs e) => ((Form) this).Close();

  private void m_plpRadioButton_CheckedChanged(object sender, EventArgs e)
  {
    if (!this.m_plpRadioButton.Checked)
      return;
    this.m_plpEditBox.Enabled = true;
    this.m_plpEditBox.ListenToPick = true;
    this.m_plpEditBox.Focus();
    this.m_frameEditBox.ListenToPick = false;
    this.m_frameEditBox.Enabled = false;
    ((Control) this.m_frameEditBox).Refresh();
    this.UpdateCreateBasicUnitStructureButtonState();
  }

  private void m_frameRadioButton_CheckedChanged(object sender, EventArgs e)
  {
    if (!this.m_frameRadioButton.Checked)
      return;
    this.m_frameEditBox.Enabled = true;
    this.m_frameEditBox.ListenToPick = true;
    this.m_frameEditBox.Focus();
    this.m_plpEditBox.ListenToPick = false;
    this.m_plpEditBox.Enabled = false;
    ((Control) this.m_frameEditBox).Refresh();
    this.UpdateCreateBasicUnitStructureButtonState();
  }

  private void m_configurationCreateEditBox_TypeValid(object sender, EventArgs e)
  {
    this.UpdateCreateBasicUnitStructureButtonState();
  }

  private void m_configurationCreateEditBox_TypeInvalid(object sender, EventArgs e)
  {
    this.m_createButton.Enabled = false;
  }

  private void m_configurationCreateEditBox_Picked(
    object sender,
    TxObjEditBoxCtrl_PickedEventArgs args)
  {
    if (args.Object is ITxPlanningObject planningObj && planningObj.IsDerivedFromPlanningType("UnitConfigurationPrototype"))
    {
      bool flag1 = this.m_typeComboBox.SelectedIndex == 0 && this.m_fixtureApp.IsConfigurationType(planningObj);
      bool flag2 = this.m_typeComboBox.SelectedIndex == 1 && this.m_fixtureApp.IsFixtureBaseType(planningObj);
      if (!flag1 && !flag2)
      {
        this.m_configurationCreateEditBox.Object = (ITxObject) null;
        ((Control) this.m_configurationCreateEditBox).Text = "";
      }
    }
    else
    {
      this.m_configurationCreateEditBox.Object = (ITxObject) null;
      ((Control) this.m_configurationCreateEditBox).Text = "";
    }
    this.UpdateCreateBasicUnitStructureButtonState();
  }

  private void m_configurationReplaceEditBox_Picked(
    object sender,
    TxObjEditBoxCtrl_PickedEventArgs args)
  {
    this.UpdateApplyButtonState();
  }

  private void m_configurationReplaceEditBox_TypeValid(object sender, EventArgs e)
  {
    this.UpdateApplyButtonState();
  }

  private void m_configurationReplaceEditBox_TypeInvalid(object sender, EventArgs e)
  {
    this.m_applyButton.Enabled = false;
  }

  private void m_variationListCtrl_SelectedIndexChanged(object sender, EventArgs e)
  {
    if (this.m_variationListCtrl.SelectedItems.Count == 1)
      this.m_updateUnitButton.Enabled = true;
    else
      this.m_updateUnitButton.Enabled = false;
  }

  private void ValidateReplacedFixtureUnit()
  {
    ITxPlanningObject objectByInternalId = new TxEmsGlobalServicesProvider().GetObjectByInternalId(CApMFFixtureDesignerUtils.GetInternalIdFromExternalId(((this.m_fixtureUnitReplaceEditBox.Object as TxCompoundResource).GetAttribute("ConfigurationPrototypeId") as TxStringAttribute).Value));
    if (objectByInternalId != null && this.m_fixtureApp.IsConfigurationType(objectByInternalId))
    {
      this.m_configValidator.ShouldIncludeConfig = true;
      this.m_configValidator.ShouldIncludeBase = false;
      if (this.m_configurationReplaceEditBox.Object == null || this.m_fixtureApp.IsConfigurationType(this.m_configurationReplaceEditBox.Object as ITxPlanningObject))
        return;
      this.m_configurationReplaceEditBox.Object = (ITxObject) null;
      ((Control) this.m_configurationReplaceEditBox).Text = "";
    }
    else
    {
      this.m_configValidator.ShouldIncludeConfig = false;
      this.m_configValidator.ShouldIncludeBase = true;
      if (this.m_configurationReplaceEditBox.Object == null || this.m_fixtureApp.IsFixtureBaseType(this.m_configurationReplaceEditBox.Object as ITxPlanningObject))
        return;
      this.m_configurationReplaceEditBox.Object = (ITxObject) null;
      ((Control) this.m_configurationReplaceEditBox).Text = "";
    }
  }

  private void m_fixtureUnitReplaceEditBox_Picked(
    object sender,
    TxObjEditBoxCtrl_PickedEventArgs args)
  {
    if (this.m_fixtureUnitReplaceEditBox.Object != null)
    {
      this.ValidateReplacedFixtureUnit();
      if (TxCompoundResource.op_Inequality(args.Object.Collection as TxCompoundResource, (ITxObject) null))
      {
        this.m_targetResourceReplaceEditBox.Object = (ITxObject) args.Object.Collection;
      }
      else
      {
        this.m_targetResourceReplaceEditBox.Object = (ITxObject) null;
        ((Control) this.m_targetResourceReplaceEditBox).Text = "";
      }
    }
    this.UpdateApplyButtonState();
  }

  private void m_fixtureUnitReplaceEditBox_TypeValid(object sender, EventArgs e)
  {
    this.UpdateApplyButtonState();
  }

  private void m_fixtureUnitReplaceEditBox_TypeInvalid(object sender, EventArgs e)
  {
    if (((Control) this.m_fixtureUnitReplaceEditBox).Text == "")
    {
      this.m_configValidator.ShouldIncludeConfig = true;
      this.m_configValidator.ShouldIncludeBase = true;
    }
    this.m_applyButton.Enabled = false;
  }

  private void m_targetResourceReplaceEditBox_Picked(
    object sender,
    TxObjEditBoxCtrl_PickedEventArgs args)
  {
    this.UpdateApplyButtonState();
  }

  private void m_targetResourceReplaceEditBox_TypeValid(object sender, EventArgs e)
  {
    this.UpdateApplyButtonState();
  }

  private void m_targetResourceReplaceEditBox_TypeInvalid(object sender, EventArgs e)
  {
    this.m_applyButton.Enabled = false;
  }

  private void m_targetResourceUpdateEditBox_Picked(
    object sender,
    TxObjEditBoxCtrl_PickedEventArgs args)
  {
    if (this.m_targetResourceUpdateEditBox.Object != null && TxCompoundResource.op_Inequality(args.Object as TxCompoundResource, (ITxObject) null))
      this.PopulateFixtureUnitBaseLists();
    this.UpdateCalculateButtonState();
  }

  private void m_targetResourceUpdateEditBox_TypeValid(object sender, EventArgs e)
  {
    this.UpdateCalculateButtonState();
  }

  private void m_targetResourceUpdateEditBox_TypeInvalid(object sender, EventArgs e)
  {
    this.m_calculateButton.Enabled = false;
  }

  private void m_fixtureUnitUpdateComboBox_SelectionChanged(object sender, EventArgs e)
  {
    this.UpdateCalculateButtonState();
    this.m_fixtureUnitMoved = false;
    this.m_updateUnitButton.Enabled = false;
  }

  private void m_fixtureBaseUpdateComboBox_SelectionChanged(object sender, EventArgs e)
  {
    this.UpdateCalculateButtonState();
  }

  private void m_fixtureUnitUpdateComboBox_Picked(
    object sender,
    TxObjComboBoxCtrl_PickedEventArgs args)
  {
    if (this.m_fixtureUnitUpdateComboBox.Object != null)
    {
      bool flag = false;
      if ((this.m_fixtureUnitUpdateComboBox.Object as TxCompoundResource).GetAttribute("ConfigurationPrototypeId") is TxStringAttribute attribute)
      {
        int idFromExternalId = CApMFFixtureDesignerUtils.GetInternalIdFromExternalId(attribute.Value);
        EmpContext empContext;
        empContext.sessionId = TxApplication.ActiveDocument.eMSSessionId;
        EmpFieldInfo field = ((IEmpObject) new EmpObjectClass()).GetField(ref empContext, ref new EmpObjectKey()
        {
          objectId = idFromExternalId
        }, "ConfigurationType");
        if (field.Value != null && ((string) field.Value).Equals("Configuration"))
        {
          flag = true;
          this.m_fixtureUnitMoved = false;
        }
      }
      if (!flag)
      {
        this.m_fixtureUnitUpdateComboBox.Object = (ITxObject) null;
        ((Control) this.m_fixtureUnitUpdateComboBox).Text = "";
      }
    }
    this.UpdateCalculateButtonState();
  }

  private void m_fixtureUnitUpdateComboBox_TypeValid(object sender, EventArgs e)
  {
    this.UpdateCalculateButtonState();
  }

  private void m_fixtureUnitUpdateComboBox_TypeInvalid(object sender, EventArgs e)
  {
    this.m_calculateButton.Enabled = false;
    this.m_restorePosition.Enabled = false;
  }

  private void m_fixtureBaseComboBox_Picked(object sender, TxObjComboBoxCtrl_PickedEventArgs args)
  {
    this.UpdateCalculateButtonState();
  }

  private void m_fixtureBaseComboBox_TypeValid(object sender, EventArgs e)
  {
    this.UpdateCalculateButtonState();
  }

  private void m_fixtureBaseComboBox_TypeInvalid(object sender, EventArgs e)
  {
    this.m_calculateButton.Enabled = false;
  }

  private void m_targetResourceCreateEditBox_Picked(
    object sender,
    TxObjEditBoxCtrl_PickedEventArgs args)
  {
    this.UpdateCreateBasicUnitStructureButtonState();
    if (this.m_targetResourceCreateEditBox.Object == null)
      return;
    if (TxCompoundResource.op_Inequality(this.m_currentTargetResource, (ITxObject) null))
      this.m_currentTargetResource.Deleted -= new TxObject_DeletedEventHandler(this.m_currentTargetResource_Deleted);
    this.m_currentTargetResource = this.m_targetResourceCreateEditBox.Object as TxCompoundResource;
    this.m_currentTargetResource.Deleted += new TxObject_DeletedEventHandler(this.m_currentTargetResource_Deleted);
  }

  private void m_currentTargetResource_Deleted(object sender, TxObject_DeletedEventArgs args)
  {
    this.m_targetResourceCreateEditBox.Object = (ITxObject) null;
    ((Control) this.m_targetResourceCreateEditBox).Text = "";
    this.UpdateCreateBasicUnitStructureButtonState();
  }

  private void m_targetResourceCreateEditBox_TypeValid(object sender, EventArgs e)
  {
    this.UpdateCreateBasicUnitStructureButtonState();
  }

  private void m_targetResourceCreateEditBox_TypeInvalid(object sender, EventArgs e)
  {
    this.m_createButton.Enabled = false;
  }

  private void m_plpEditBox_Picked(object sender, TxObjEditBoxCtrl_PickedEventArgs args)
  {
    if (args.Object is ITxProcessModelObject processModelObject)
    {
      if (!processModelObject.PlanningRepresentation.PlanningType.Equals("PmPLP"))
      {
        this.m_plpEditBox.Object = (ITxObject) null;
        ((Control) this.m_plpEditBox).Text = "";
      }
    }
    else
    {
      this.m_plpEditBox.Object = (ITxObject) null;
      ((Control) this.m_plpEditBox).Text = "";
    }
    this.UpdateCreateBasicUnitStructureButtonState();
  }

  private void m_plpEditBox_TypeValid(object sender, EventArgs e)
  {
    this.UpdateCreateBasicUnitStructureButtonState();
  }

  private void m_plpEditBox_TypeInvalid(object sender, EventArgs e)
  {
    this.m_createButton.Enabled = false;
  }

  private void m_frameEditBox_Picked(object sender, TxFrameEditBoxCtrl_PickedEventArgs args)
  {
    this.m_locatingObject = args.Object;
  }

  private void m_frameEditBox_ValidFrameSet(
    object sender,
    TxFrameEditBoxCtrl_ValidFrameSetEventArgs args)
  {
    this.isValidFrameSet = true;
    this.m_fixtureApp.CreateFrameInGraphicViewer(this.m_frameEditBox.GetLocation());
    this.UpdateCreateBasicUnitStructureButtonState();
  }

  private void m_frameEditBox_InvalidFrameSet(
    object sender,
    TxFrameEditBoxCtrl_InvalidFrameSetEventArgs args)
  {
    this.isValidFrameSet = false;
    this.m_fixtureApp.DeleteFrame();
    this.m_createButton.Enabled = false;
    this.m_locatingObject = (ITxObject) null;
  }

  private void m_createButton_Click(object sender, EventArgs e)
  {
    TxApplication.ActiveUndoManager.StartTransaction();
    Cursor current = Cursor.Current;
    Cursor.Current = Cursors.WaitCursor;
    TxPlanningObject configurationPlanningObj = this.m_configurationCreateEditBox.Object as TxPlanningObject;
    TxCompoundResource targetResource = this.m_targetResourceCreateEditBox.Object as TxCompoundResource;
    TxTransformation txTransformation = !this.m_plpRadioButton.Checked ? this.m_frameEditBox.GetLocation() : (this.m_plpEditBox.Object as TxMfgFeature).AbsoluteLocation;
    TxEmsServicesProvider servicesProvider = configurationPlanningObj.PlatformServicesProvider as TxEmsServicesProvider;
    TxTransformation location = txTransformation;
    TxTransformation fixtureUnitOrigin = CApMFFixtureDesignerUtils.GetFixtureUnitOrigin(servicesProvider.InternalId);
    if (TxTransformation.op_Inequality(fixtureUnitOrigin, (TxTransformation) null))
      location = new TxTransformation(new TxVector(txTransformation.Translation.X + fixtureUnitOrigin.Translation.X, txTransformation.Translation.Y + fixtureUnitOrigin.Translation.Y, txTransformation.Translation.Z + fixtureUnitOrigin.Translation.Z), new TxVector(txTransformation.RotationRPY_XYZ.X + fixtureUnitOrigin.RotationRPY_XYZ.X, txTransformation.RotationRPY_XYZ.Y + fixtureUnitOrigin.RotationRPY_XYZ.Y, txTransformation.RotationRPY_XYZ.Z + fixtureUnitOrigin.RotationRPY_XYZ.Z), (TxTransformation.TxRotationType) 1);
    new CApMFFixtureDesignerEmsHandler().ImportDataToCache(servicesProvider.InternalId);
    TxCompoundResource compoundResource = this.m_typeComboBox.SelectedIndex != 0 ? this.m_fixtureApp.CreateConfigurationInStudy(configurationPlanningObj, targetResource, location, true) : this.m_fixtureApp.CreateConfigurationInStudy(configurationPlanningObj, targetResource, location, false);
    if (this.m_plpRadioButton.Checked && this.m_plpEditBox.Object != null)
      TxCompoundResourceEx.SetLocatingObjectForFixture(compoundResource, this.m_plpEditBox.Object);
    else if (!this.m_plpRadioButton.Checked && this.m_locatingObject != null)
    {
      TxCompoundResourceEx.SetLocatingObjectForFixture(compoundResource, this.m_locatingObject);
    }
    else
    {
      TxTransformationAttribute transformationAttribute = new TxTransformationAttribute("LocatingPoint", this.m_frameEditBox.GetLocation());
      compoundResource.SetAttribute((TxAttribute) transformationAttribute);
    }
    this.m_fixtureApp.DeleteFrame();
    TxApplication.ActiveUndoManager.EndTransaction();
    TxApplication.RefreshDisplay();
    Cursor.Current = current;
    this.m_plpEditBox.Object = (ITxObject) null;
    ((Control) this.m_plpEditBox).Text = "";
    ((Control) this.m_frameEditBox).Text = "";
    this.m_locatingObject = (ITxObject) null;
    this.m_configurationCreateEditBox.Object = (ITxObject) null;
    ((Control) this.m_configurationCreateEditBox).Text = "";
    this.m_createButton.Enabled = false;
  }

  private void UpdateCalculateButtonState()
  {
    if (this.m_targetResourceUpdateEditBox.Object != null && this.m_fixtureUnitUpdateComboBox.Object != null && this.m_fixtureBaseUpdateComboBox.Object != null)
      this.m_calculateButton.Enabled = true;
    else
      this.m_calculateButton.Enabled = false;
    if (this.m_fixtureUnitUpdateComboBox.Object != null)
      this.m_restorePosition.Enabled = true;
    else
      this.m_restorePosition.Enabled = false;
  }

  private void UpdateCreateBasicUnitStructureButtonState()
  {
    if (this.m_targetResourceCreateEditBox.Object != null && this.m_configurationCreateEditBox.Object != null && (this.m_plpRadioButton.Checked && this.m_plpEditBox.Object != null || this.m_frameRadioButton.Checked && this.isValidFrameSet))
      this.m_createButton.Enabled = true;
    else
      this.m_createButton.Enabled = false;
  }

  private void UpdateApplyButtonState()
  {
    if (this.m_fixtureUnitReplaceEditBox.Object != null && this.m_targetResourceReplaceEditBox.Object != null && this.m_configurationReplaceEditBox.Object != null)
      this.m_applyButton.Enabled = true;
    else
      this.m_applyButton.Enabled = false;
  }

  private void PopulateFixtureUnitBaseLists()
  {
    TxObjectList allDescendants = (this.m_targetResourceUpdateEditBox.Object as TxCompoundResource).GetAllDescendants((ITxTypeFilter) new TxTypeFilter(typeof (TxCompoundResource)));
    this.m_fixtureUnitUpdateComboBox.Clear();
    this.m_fixtureBaseUpdateComboBox.Clear();
    foreach (TxCompoundResource compoundResource in (Collection<ITxObject>) allDescendants)
    {
      if (compoundResource.GetAttribute("ConfigurationPrototypeId") is TxStringAttribute attribute)
      {
        int idFromExternalId = CApMFFixtureDesignerUtils.GetInternalIdFromExternalId(attribute.Value);
        if (CApMFFixtureDesignerUtils.DoesObjectExistInEms(idFromExternalId))
        {
          EmpContext empContext;
          empContext.sessionId = TxApplication.ActiveDocument.eMSSessionId;
          EmpFieldInfo field = ((IEmpObject) new EmpObjectClass()).GetField(ref empContext, ref new EmpObjectKey()
          {
            objectId = idFromExternalId
          }, "ConfigurationType");
          if (field.Value != null)
          {
            switch ((string) field.Value)
            {
              case "Configuration":
                this.m_fixtureUnitUpdateComboBox.AddItem(compoundResource.Name, (ITxObject) compoundResource);
                compoundResource.Deleted += new TxObject_DeletedEventHandler(this.fixtureUnit_Deleted);
                continue;
              case "FixtureBase":
                this.m_fixtureBaseUpdateComboBox.AddItem(compoundResource.Name, (ITxObject) compoundResource);
                compoundResource.Deleted += new TxObject_DeletedEventHandler(this.fixtureBase_Deleted);
                continue;
              default:
                continue;
            }
          }
        }
      }
    }
  }

  private void fixtureBase_Deleted(object sender, TxObject_DeletedEventArgs args)
  {
    TxCompoundResource compoundResource = sender as TxCompoundResource;
    if (this.m_fixtureBaseUpdateComboBox.Object == compoundResource)
    {
      this.m_fixtureBaseUpdateComboBox.Object = (ITxObject) null;
      ((Control) this.m_fixtureBaseUpdateComboBox).Text = "";
    }
    this.m_fixtureBaseUpdateComboBox.RemoveItem((ITxObject) compoundResource);
    compoundResource.Deleted -= new TxObject_DeletedEventHandler(this.fixtureBase_Deleted);
    this.UpdateCalculateButtonState();
  }

  private void fixtureUnit_Deleted(object sender, TxObject_DeletedEventArgs args)
  {
    TxCompoundResource compoundResource = sender as TxCompoundResource;
    if (this.m_fixtureUnitUpdateComboBox.Object == compoundResource)
    {
      this.m_fixtureUnitUpdateComboBox.Object = (ITxObject) null;
      ((Control) this.m_fixtureUnitUpdateComboBox).Text = "";
    }
    this.m_fixtureUnitUpdateComboBox.RemoveItem((ITxObject) compoundResource);
    compoundResource.Deleted -= new TxObject_DeletedEventHandler(this.fixtureUnit_Deleted);
    this.UpdateCalculateButtonState();
  }

  private void m_applyButton_Click(object sender, EventArgs e)
  {
    TxApplication.ActiveUndoManager.StartTransaction();
    Cursor current = Cursor.Current;
    Cursor.Current = Cursors.WaitCursor;
    TxCompoundResource compoundResource = this.m_fixtureUnitReplaceEditBox.Object as TxCompoundResource;
    TxCompoundResource targetResource = this.m_targetResourceReplaceEditBox.Object as TxCompoundResource;
    if (TxCompoundResource.op_Equality(compoundResource, (ITxObject) targetResource))
    {
      ResourceManager resourceManager = new ResourceManager("ModularFixture.FixtureDesigner.Res.StringTable", ((object) this).GetType().Assembly);
      int num = (int) TxMessageBox.Show(resourceManager.GetString("IDENTICAL_FIXTURE_UNIT_AND_TARGET_RESOURCE_ERROR_MESSAGE"), resourceManager.GetString("DESIGNER_APPLICATION_CMD_NAME"), MessageBoxButtons.OK, MessageBoxIcon.Hand);
    }
    else
    {
      TxPlanningObject configurationPlanningObj = this.m_configurationReplaceEditBox.Object as TxPlanningObject;
      new CApMFFixtureDesignerEmsHandler().ImportDataToCache((configurationPlanningObj.PlatformServicesProvider as TxEmsServicesProvider).InternalId);
      if (this.m_fixtureApp.IsConfigurationType(CApMFFixtureDesignerUtils.GetInternalIdFromExternalId((compoundResource.GetAttribute("ConfigurationPrototypeId") as TxStringAttribute).Value)))
        this.m_fixtureApp.CreateConfigurationInStudy(configurationPlanningObj, targetResource, compoundResource.AbsoluteLocation, false);
      else
        this.m_fixtureApp.CreateConfigurationInStudy(configurationPlanningObj, targetResource, compoundResource.AbsoluteLocation, true);
      compoundResource.Delete();
      ((Control) this.m_fixtureUnitReplaceEditBox).Text = "";
      this.m_fixtureUnitReplaceEditBox.Object = (ITxObject) null;
      ((Control) this.m_targetResourceReplaceEditBox).Text = "";
      this.m_targetResourceReplaceEditBox.Object = (ITxObject) null;
      ((Control) this.m_configurationReplaceEditBox).Text = "";
      this.m_configurationReplaceEditBox.Object = (ITxObject) null;
      this.m_applyButton.Enabled = false;
      TxApplication.RefreshDisplay();
      Cursor.Current = current;
      TxApplication.ActiveUndoManager.EndTransaction();
    }
  }

  private void m_calculateButton_Click(object sender, EventArgs e)
  {
    Cursor current = Cursor.Current;
    Cursor.Current = Cursors.WaitCursor;
    this.m_variationListCtrl.Items.Clear();
    if (this.m_solutions != null)
      this.m_solutions.Clear();
    this.m_updateUnitButton.Enabled = false;
    TxCompoundResource root = this.m_fixtureUnitUpdateComboBox.Object as TxCompoundResource;
    TxStringAttribute attribute1 = root.GetAttribute("ConfigurationPrototypeId") as TxStringAttribute;
    TxCompoundResource compoundResource = this.m_fixtureBaseUpdateComboBox.Object as TxCompoundResource;
    TxStringAttribute attribute2 = compoundResource.GetAttribute("ConfigurationPrototypeId") as TxStringAttribute;
    if (attribute1 != null && attribute2 != null)
    {
      TxEmsGlobalServicesProvider servicesProvider = new TxEmsGlobalServicesProvider();
      int idFromExternalId1 = CApMFFixtureDesignerUtils.GetInternalIdFromExternalId(attribute1.Value);
      int idFromExternalId2 = CApMFFixtureDesignerUtils.GetInternalIdFromExternalId(attribute2.Value);
      if (!CApMFFixtureDesignerUtils.DoesObjectExistInEms(idFromExternalId1))
      {
        ResourceManager resourceManager = new ResourceManager("ModularFixture.FixtureDesigner.Res.StringTable", ((object) this).GetType().Assembly);
        int num = (int) TxMessageBox.Show(resourceManager.GetString("CONFIGURATION_PROTOTYPE_DOESNT_EXIST_IN_EMS_MESSAGE"), resourceManager.GetString("DESIGNER_APPLICATION_CMD_NAME"), MessageBoxButtons.OK, MessageBoxIcon.Hand);
        return;
      }
      if (!CApMFFixtureDesignerUtils.DoesObjectExistInEms(idFromExternalId2))
      {
        ResourceManager resourceManager = new ResourceManager("ModularFixture.FixtureDesigner.Res.StringTable", ((object) this).GetType().Assembly);
        int num = (int) TxMessageBox.Show(resourceManager.GetString("FIXTUREBASE_PROTOTYPE_DOESNT_EXIST_IN_EMS_MESSAGE"), resourceManager.GetString("DESIGNER_APPLICATION_CMD_NAME"), MessageBoxButtons.OK, MessageBoxIcon.Hand);
        return;
      }
      ITxPlanningObject objectByInternalId = servicesProvider.GetObjectByInternalId(idFromExternalId1);
      TxTransformation fixtureUnitLocation = root.AbsoluteLocation;
      if (this.m_fixtureUnitMoved)
        fixtureUnitLocation = TxTransformation.op_Multiply(fixtureUnitLocation, this.m_fixtureUnitOffset.Inverse);
      root.AbsoluteLocation = fixtureUnitLocation;
      ITxTypeFilter itxTypeFilter = (ITxTypeFilter) new TxNoTypeFilter();
      foreach (ITxObject directDescendant in (Collection<ITxObject>) root.GetDirectDescendants(itxTypeFilter))
        directDescendant.Delete();
      new CApMFFixtureDesignerEmsHandler().ImportDataToCache(idFromExternalId1);
      this.m_fixtureApp.CreateConfigurationDescendantsInStudy(root, objectByInternalId as TxPlanningObject, this.m_targetResourceUpdateEditBox.Object as TxCompoundResource, false);
      this.m_fixtureUnitUpdateComboBox.Object = (ITxObject) root;
      root.RemoveAttribute("ValidSolution");
      this.m_fixtureUnitMoved = false;
      TxApplication.RefreshDisplay();
      TxTransformation fixtureBaseLocation = new TxTransformation(compoundResource.AbsoluteLocation);
      this.m_solutions = this.m_fixtureApp.CalculatePossibleSolutions(idFromExternalId1, idFromExternalId2, fixtureUnitLocation, fixtureBaseLocation, ref this.m_validSolutions);
      if (this.m_solutions != null && this.m_solutions.Count > 0)
      {
        this.AddSolutionsToListControl(root.Name);
      }
      else
      {
        ResourceManager resourceManager = new ResourceManager("DnProcessSimulateCommands.ModularFixture.FixtureDesigner.Res.StringTable", ((object) this).GetType().Assembly, (Type) null);
        int num = (int) TxMessageBox.Show(resourceManager.GetString("NO_SOLUTIONS_FOUND"), resourceManager.GetString("DESIGNER_APPLICATION_CMD_NAME"), MessageBoxButtons.OK, MessageBoxIcon.Hand);
      }
    }
    Cursor.Current = current;
  }

  private void AddSolutionsToListControl(string configurationName)
  {
    for (int index = 0; index < this.m_solutions.Count && (Decimal) index < this.m_solutionsNumericUpDown.Value; ++index)
    {
      ListViewItem listViewItem = new ListViewItem()
      {
        SubItems = {
          [0] = {
            Text = $"{configurationName}_{(index + 1).ToString()}"
          }
        }
      };
      listViewItem.SubItems.Add(((CApMFFixtureDesignerSolution) this.m_solutions[index]).Distance.ToString());
      if (!this.m_validSolutions)
      {
        double num1 = Math.Round((double) ((CApMFFixtureDesignerSolution) this.m_solutions[index]).Tolerance[0], 2);
        double num2 = Math.Round((double) ((CApMFFixtureDesignerSolution) this.m_solutions[index]).Tolerance[1], 2);
        double num3 = (double) ((CApMFFixtureDesignerSolution) this.m_solutions[index]).Tolerance[2];
        num3 = Math.Round(num3, 2);
        listViewItem.ForeColor = Color.Red;
        listViewItem.ToolTipText = $"Tolerance: X={num1.ToString()}  Y={num2.ToString()}  Z={num3.ToString()}";
      }
      this.m_variationListCtrl.Items.Add(listViewItem);
    }
  }

  private void m_updateUnitButton_Click(object sender, EventArgs e)
  {
    Cursor current = Cursor.Current;
    Cursor.Current = Cursors.WaitCursor;
    TxApplication.ActiveUndoManager.StartTransaction();
    TxCompoundResource fixtureUnitCompRes = this.m_fixtureUnitUpdateComboBox.Object as TxCompoundResource;
    int idFromExternalId = CApMFFixtureDesignerUtils.GetInternalIdFromExternalId((fixtureUnitCompRes.GetAttribute("ConfigurationPrototypeId") as TxStringAttribute).Value);
    int selectedIndex = this.m_variationListCtrl.SelectedIndices[0];
    CApMFFixtureDesignerSolution solution = (CApMFFixtureDesignerSolution) this.m_solutions[selectedIndex];
    this.m_fixtureApp.CreateFullFixtureStructure(idFromExternalId, fixtureUnitCompRes, ref solution);
    if (!this.m_fixtureUnitMoved)
      this.m_fixtureUnitPreviousLocation = new TxTransformation(fixtureUnitCompRes.AbsoluteLocation);
    TxIntAttribute txIntAttribute;
    if (this.m_validSolutions)
    {
      this.m_fixtureApp.PlaceFixtureUnit(ref fixtureUnitCompRes, solution);
      this.m_fixtureUnitMoved = true;
      txIntAttribute = new TxIntAttribute("ValidSolution", 1);
    }
    else
      txIntAttribute = new TxIntAttribute("ValidSolution", 0);
    fixtureUnitCompRes.SetAttribute((TxAttribute) txIntAttribute);
    this.m_fixtureUnitOffset = TxTransformation.op_Multiply(this.m_fixtureUnitPreviousLocation.Inverse, fixtureUnitCompRes.AbsoluteLocation);
    fixtureUnitCompRes.Display();
    TxApplication.RefreshDisplay();
    this.m_variationListCtrl.Items[selectedIndex].Selected = true;
    TxApplication.ActiveUndoManager.EndTransaction();
    Cursor.Current = current;
  }

  private void m_searchConstraints_Click(object sender, EventArgs e)
  {
    string path1 = TxApplicationEx.SysRootAppDataPath() + "\\ModularFixture\\";
    string path2 = "MFSearchFields.xml";
    if (!new FileInfo(Path.Combine(path1, path2)).Exists)
    {
      ResourceManager resourceManager = new ResourceManager("DnProcessSimulateCommands.ModularFixture.FixtureDesigner.Res.StringTable", ((object) this).GetType().Assembly, (Type) null);
      int num = (int) TxMessageBox.Show(resourceManager.GetString("FAILED_TO_LOAD_FILE_MESSAGE") + path2, resourceManager.GetString("DESIGNER_APPLICATION_CMD_NAME"), MessageBoxButtons.OK, MessageBoxIcon.Hand);
    }
    else
    {
      CUiMFSearchConstraintsDlg searchConstraintsDlg = new CUiMFSearchConstraintsDlg(ref this.m_searchConditionsContained, ref this.m_searchConditionsNotContained, this.m_fixtureApp.SolutionContainsOperator, this.m_fixtureApp.SolutionDoesntContainOperator);
      int num = (int) ((Form) searchConstraintsDlg).ShowDialog();
      this.m_fixtureApp.SetConditions(ref this.m_searchConditionsContained, ref this.m_searchConditionsNotContained, searchConstraintsDlg.SolutionContainsOperator, searchConstraintsDlg.SolutionDoesntContainOperator);
    }
  }

  private void m_restorePosition_Click(object sender, EventArgs e)
  {
    bool flag = false;
    TxCompoundResource compoundResource = this.m_fixtureUnitUpdateComboBox.Object as TxCompoundResource;
    ITxObject objectForFixture = TxCompoundResourceEx.GetLocatingObjectForFixture(compoundResource);
    if (objectForFixture != null && objectForFixture is ITxLocatableObject itxLocatableObject)
    {
      compoundResource.AbsoluteLocation = itxLocatableObject.AbsoluteLocation;
      this.m_fixtureUnitMoved = false;
      flag = true;
    }
    if (!flag && compoundResource.GetAttribute("LocatingPoint") is TxTransformationAttribute attribute)
    {
      compoundResource.AbsoluteLocation = attribute.Value;
      this.m_fixtureUnitMoved = false;
    }
    TxApplication.RefreshDisplay();
  }

  private void m_fixtureUnitUpdateComboBox_Enter(object sender, EventArgs e)
  {
    this.m_fixtureUnitUpdateComboBox.Focus();
  }

  private void m_fixtureUnitUpdateComboBox_Leave(object sender, EventArgs e)
  {
    this.m_fixtureUnitUpdateComboBox.LoseFocus();
  }

  private void m_fixtureBaseUpdateComboBox_Enter(object sender, EventArgs e)
  {
    this.m_fixtureBaseUpdateComboBox.Focus();
  }

  private void m_fixtureBaseUpdateComboBox_Leave(object sender, EventArgs e)
  {
    this.m_fixtureBaseUpdateComboBox.LoseFocus();
  }

  internal bool IsOpened => this.m_isOpened;

  protected virtual void Dispose(bool disposing)
  {
    if (disposing && this.components != null)
      this.components.Dispose();
    base.Dispose(disposing);
  }

  private void InitializeComponent()
  {
    this.components = (IContainer) new Container();
    ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof (CUiMFFixtureDesignerApplicationDlg));
    this.m_variationListCtrl = new ListView();
    this.m_variationColumnHeader = new ColumnHeader();
    this.m_distanceColumnHeader = new ColumnHeader();
    this.m_fixtureUnitUpdateLabel = new Label();
    this.m_closeButton = new Button();
    this.m_targetResourceCreateLabel = new Label();
    this.m_configurationCreateLabel = new Label();
    this.m_referenceLabel = new Label();
    this.m_plpRadioButton = new RadioButton();
    this.m_frameRadioButton = new RadioButton();
    this.m_createButton = new Button();
    this.m_tabControl = new TabControl();
    this.tabPage1 = new TabPage();
    this.m_frameEditBox = new TxFrameEditBoxCtrl();
    this.label1 = new Label();
    this.m_typeComboBox = new ComboBox();
    this.m_configurationCreateEditBox = new TxObjEditBoxCtrl();
    this.m_plpEditBox = new TxObjEditBoxCtrl();
    this.m_targetResourceCreateEditBox = new TxObjEditBoxCtrl();
    this.tabPage2 = new TabPage();
    this.m_restorePosition = new Button();
    this.m_searchConstraints = new Button();
    this.m_fixtureBaseUpdateComboBox = new TxObjComboBoxCtrl();
    this.m_fixtureUnitUpdateComboBox = new TxObjComboBoxCtrl();
    this.m_targetResourceUpdateEditBox = new TxObjEditBoxCtrl();
    this.m_updateUnitButton = new Button();
    this.m_calculateButton = new Button();
    this.m_solutionsNumericUpDown = new NumericUpDown();
    this.m_solutionsNumberLabel = new Label();
    this.m_fixtureBaseLabel = new Label();
    this.m_targetResourceUpdateLabel = new Label();
    this.tabPage3 = new TabPage();
    this.m_configurationReplaceEditBox = new TxObjEditBoxCtrl();
    this.m_fixtureUnitReplaceEditBox = new TxObjEditBoxCtrl();
    this.m_targetResourceReplaceEditBox = new TxObjEditBoxCtrl();
    this.m_applyButton = new Button();
    this.m_configurationReplaceLabel = new Label();
    this.m_targetResourceReplaceLabel = new Label();
    this.m_fixtureUnitReplaceLabel = new Label();
    this.m_toolTip1 = new ToolTip(this.components);
    this.m_tabControl.SuspendLayout();
    this.tabPage1.SuspendLayout();
    this.tabPage2.SuspendLayout();
    this.m_solutionsNumericUpDown.BeginInit();
    this.tabPage3.SuspendLayout();
    ((Control) this).SuspendLayout();
    this.m_variationListCtrl.Columns.AddRange(new ColumnHeader[2]
    {
      this.m_variationColumnHeader,
      this.m_distanceColumnHeader
    });
    this.m_variationListCtrl.FullRowSelect = true;
    this.m_variationListCtrl.GridLines = true;
    this.m_variationListCtrl.HeaderStyle = ColumnHeaderStyle.Nonclickable;
    this.m_variationListCtrl.HideSelection = false;
    componentResourceManager.ApplyResources((object) this.m_variationListCtrl, "m_variationListCtrl");
    this.m_variationListCtrl.MultiSelect = false;
    this.m_variationListCtrl.Name = "m_variationListCtrl";
    this.m_variationListCtrl.ShowItemToolTips = true;
    this.m_variationListCtrl.UseCompatibleStateImageBehavior = false;
    this.m_variationListCtrl.View = View.Details;
    this.m_variationListCtrl.SelectedIndexChanged += new EventHandler(this.m_variationListCtrl_SelectedIndexChanged);
    componentResourceManager.ApplyResources((object) this.m_variationColumnHeader, "m_variationColumnHeader");
    componentResourceManager.ApplyResources((object) this.m_distanceColumnHeader, "m_distanceColumnHeader");
    componentResourceManager.ApplyResources((object) this.m_fixtureUnitUpdateLabel, "m_fixtureUnitUpdateLabel");
    this.m_fixtureUnitUpdateLabel.Name = "m_fixtureUnitUpdateLabel";
    componentResourceManager.ApplyResources((object) this.m_closeButton, "m_closeButton");
    this.m_closeButton.Name = "m_closeButton";
    this.m_closeButton.UseVisualStyleBackColor = true;
    this.m_closeButton.Click += new EventHandler(this.m_closeButton_Click);
    componentResourceManager.ApplyResources((object) this.m_targetResourceCreateLabel, "m_targetResourceCreateLabel");
    this.m_targetResourceCreateLabel.Name = "m_targetResourceCreateLabel";
    componentResourceManager.ApplyResources((object) this.m_configurationCreateLabel, "m_configurationCreateLabel");
    this.m_configurationCreateLabel.Name = "m_configurationCreateLabel";
    componentResourceManager.ApplyResources((object) this.m_referenceLabel, "m_referenceLabel");
    this.m_referenceLabel.Name = "m_referenceLabel";
    componentResourceManager.ApplyResources((object) this.m_plpRadioButton, "m_plpRadioButton");
    this.m_plpRadioButton.Checked = true;
    this.m_plpRadioButton.Name = "m_plpRadioButton";
    this.m_plpRadioButton.TabStop = true;
    this.m_plpRadioButton.UseVisualStyleBackColor = true;
    this.m_plpRadioButton.CheckedChanged += new EventHandler(this.m_plpRadioButton_CheckedChanged);
    componentResourceManager.ApplyResources((object) this.m_frameRadioButton, "m_frameRadioButton");
    this.m_frameRadioButton.Name = "m_frameRadioButton";
    this.m_frameRadioButton.UseVisualStyleBackColor = true;
    this.m_frameRadioButton.CheckedChanged += new EventHandler(this.m_frameRadioButton_CheckedChanged);
    componentResourceManager.ApplyResources((object) this.m_createButton, "m_createButton");
    this.m_createButton.Name = "m_createButton";
    this.m_createButton.UseVisualStyleBackColor = true;
    this.m_createButton.Click += new EventHandler(this.m_createButton_Click);
    this.m_tabControl.Controls.Add((Control) this.tabPage1);
    this.m_tabControl.Controls.Add((Control) this.tabPage2);
    this.m_tabControl.Controls.Add((Control) this.tabPage3);
    componentResourceManager.ApplyResources((object) this.m_tabControl, "m_tabControl");
    this.m_tabControl.Name = "m_tabControl";
    this.m_tabControl.SelectedIndex = 0;
    this.m_tabControl.SelectedIndexChanged += new EventHandler(this.m_tabControl_SelectedIndexChanged);
    this.tabPage1.Controls.Add((Control) this.m_frameEditBox);
    this.tabPage1.Controls.Add((Control) this.label1);
    this.tabPage1.Controls.Add((Control) this.m_typeComboBox);
    this.tabPage1.Controls.Add((Control) this.m_configurationCreateEditBox);
    this.tabPage1.Controls.Add((Control) this.m_plpEditBox);
    this.tabPage1.Controls.Add((Control) this.m_targetResourceCreateEditBox);
    this.tabPage1.Controls.Add((Control) this.m_createButton);
    this.tabPage1.Controls.Add((Control) this.m_targetResourceCreateLabel);
    this.tabPage1.Controls.Add((Control) this.m_configurationCreateLabel);
    this.tabPage1.Controls.Add((Control) this.m_referenceLabel);
    this.tabPage1.Controls.Add((Control) this.m_frameRadioButton);
    this.tabPage1.Controls.Add((Control) this.m_plpRadioButton);
    componentResourceManager.ApplyResources((object) this.tabPage1, "tabPage1");
    this.tabPage1.Name = "tabPage1";
    this.tabPage1.UseVisualStyleBackColor = true;
    this.m_frameEditBox.EnableRelativeToWorkingFrameCoordinates = true;
    this.m_frameEditBox.ListenToPick = false;
    componentResourceManager.ApplyResources((object) this.m_frameEditBox, "m_frameEditBox");
    ((Control) this.m_frameEditBox).Name = "m_frameEditBox";
    this.m_frameEditBox.ValidFrameSet += new TxFrameEditBoxCtrl_ValidFrameSetEventHandler(this.m_frameEditBox_ValidFrameSet);
    this.m_frameEditBox.Picked += new TxFrameEditBoxCtrl_PickedEventHandler(this.m_frameEditBox_Picked);
    this.m_frameEditBox.InvalidFrameSet += new TxFrameEditBoxCtrl_InvalidFrameSetEventHandler(this.m_frameEditBox_InvalidFrameSet);
    componentResourceManager.ApplyResources((object) this.label1, "label1");
    this.label1.Name = "label1";
    this.m_typeComboBox.DropDownStyle = ComboBoxStyle.DropDownList;
    this.m_typeComboBox.FormattingEnabled = true;
    componentResourceManager.ApplyResources((object) this.m_typeComboBox, "m_typeComboBox");
    this.m_typeComboBox.Name = "m_typeComboBox";
    this.m_configurationCreateEditBox.ListenToPick = false;
    componentResourceManager.ApplyResources((object) this.m_configurationCreateEditBox, "m_configurationCreateEditBox");
    ((Control) this.m_configurationCreateEditBox).Name = "m_configurationCreateEditBox";
    this.m_configurationCreateEditBox.Object = (ITxObject) null;
    this.m_configurationCreateEditBox.PickLevel = (TxPickLevel) 1;
    this.m_configurationCreateEditBox.ReadOnly = false;
    this.m_configurationCreateEditBox.ValidatorType = (TxValidatorType) 1;
    this.m_configurationCreateEditBox.TypeInvalid += new EventHandler(this.m_configurationCreateEditBox_TypeInvalid);
    this.m_configurationCreateEditBox.TypeValid += new EventHandler(this.m_configurationCreateEditBox_TypeValid);
    this.m_configurationCreateEditBox.Picked += new TxObjEditBoxCtrl_PickedEventHandler(this.m_configurationCreateEditBox_Picked);
    this.m_plpEditBox.ListenToPick = false;
    componentResourceManager.ApplyResources((object) this.m_plpEditBox, "m_plpEditBox");
    ((Control) this.m_plpEditBox).Name = "m_plpEditBox";
    this.m_plpEditBox.Object = (ITxObject) null;
    this.m_plpEditBox.PickLevel = (TxPickLevel) 1;
    this.m_plpEditBox.ReadOnly = false;
    this.m_plpEditBox.ValidatorType = (TxValidatorType) 1;
    this.m_plpEditBox.TypeInvalid += new EventHandler(this.m_plpEditBox_TypeInvalid);
    this.m_plpEditBox.TypeValid += new EventHandler(this.m_plpEditBox_TypeValid);
    this.m_plpEditBox.Picked += new TxObjEditBoxCtrl_PickedEventHandler(this.m_plpEditBox_Picked);
    this.m_targetResourceCreateEditBox.ListenToPick = false;
    componentResourceManager.ApplyResources((object) this.m_targetResourceCreateEditBox, "m_targetResourceCreateEditBox");
    ((Control) this.m_targetResourceCreateEditBox).Name = "m_targetResourceCreateEditBox";
    this.m_targetResourceCreateEditBox.Object = (ITxObject) null;
    this.m_targetResourceCreateEditBox.PickLevel = (TxPickLevel) 1;
    this.m_targetResourceCreateEditBox.ReadOnly = false;
    this.m_targetResourceCreateEditBox.ValidatorType = (TxValidatorType) 1;
    this.m_targetResourceCreateEditBox.TypeInvalid += new EventHandler(this.m_targetResourceCreateEditBox_TypeInvalid);
    this.m_targetResourceCreateEditBox.TypeValid += new EventHandler(this.m_targetResourceCreateEditBox_TypeValid);
    this.m_targetResourceCreateEditBox.Picked += new TxObjEditBoxCtrl_PickedEventHandler(this.m_targetResourceCreateEditBox_Picked);
    this.tabPage2.Controls.Add((Control) this.m_restorePosition);
    this.tabPage2.Controls.Add((Control) this.m_searchConstraints);
    this.tabPage2.Controls.Add((Control) this.m_fixtureBaseUpdateComboBox);
    this.tabPage2.Controls.Add((Control) this.m_fixtureUnitUpdateComboBox);
    this.tabPage2.Controls.Add((Control) this.m_targetResourceUpdateEditBox);
    this.tabPage2.Controls.Add((Control) this.m_updateUnitButton);
    this.tabPage2.Controls.Add((Control) this.m_calculateButton);
    this.tabPage2.Controls.Add((Control) this.m_solutionsNumericUpDown);
    this.tabPage2.Controls.Add((Control) this.m_variationListCtrl);
    this.tabPage2.Controls.Add((Control) this.m_solutionsNumberLabel);
    this.tabPage2.Controls.Add((Control) this.m_fixtureBaseLabel);
    this.tabPage2.Controls.Add((Control) this.m_targetResourceUpdateLabel);
    this.tabPage2.Controls.Add((Control) this.m_fixtureUnitUpdateLabel);
    componentResourceManager.ApplyResources((object) this.tabPage2, "tabPage2");
    this.tabPage2.Name = "tabPage2";
    this.tabPage2.UseVisualStyleBackColor = true;
    componentResourceManager.ApplyResources((object) this.m_restorePosition, "m_restorePosition");
    this.m_restorePosition.Name = "m_restorePosition";
    this.m_restorePosition.UseVisualStyleBackColor = true;
    this.m_restorePosition.Click += new EventHandler(this.m_restorePosition_Click);
    componentResourceManager.ApplyResources((object) this.m_searchConstraints, "m_searchConstraints");
    this.m_searchConstraints.Name = "m_searchConstraints";
    this.m_searchConstraints.UseVisualStyleBackColor = true;
    this.m_searchConstraints.Click += new EventHandler(this.m_searchConstraints_Click);
    this.m_fixtureBaseUpdateComboBox.DropDownStyle = ComboBoxStyle.DropDown;
    this.m_fixtureBaseUpdateComboBox.ListenToPick = false;
    componentResourceManager.ApplyResources((object) this.m_fixtureBaseUpdateComboBox, "m_fixtureBaseUpdateComboBox");
    ((Control) this.m_fixtureBaseUpdateComboBox).Name = "m_fixtureBaseUpdateComboBox";
    this.m_fixtureBaseUpdateComboBox.Object = (ITxObject) null;
    this.m_fixtureBaseUpdateComboBox.PickLevel = (TxPickLevel) 1;
    this.m_fixtureBaseUpdateComboBox.ValidatorType = (TxValidatorType) 1;
    this.m_fixtureBaseUpdateComboBox.SelectionChanged += new EventHandler(this.m_fixtureBaseUpdateComboBox_SelectionChanged);
    this.m_fixtureBaseUpdateComboBox.TypeInvalid += new EventHandler(this.m_fixtureBaseComboBox_TypeInvalid);
    this.m_fixtureBaseUpdateComboBox.TypeValid += new EventHandler(this.m_fixtureBaseComboBox_TypeValid);
    ((Control) this.m_fixtureBaseUpdateComboBox).Leave += new EventHandler(this.m_fixtureBaseUpdateComboBox_Leave);
    this.m_fixtureBaseUpdateComboBox.Picked += new TxObjComboBoxCtrl_PickedEventHandler(this.m_fixtureBaseComboBox_Picked);
    ((Control) this.m_fixtureBaseUpdateComboBox).Enter += new EventHandler(this.m_fixtureBaseUpdateComboBox_Enter);
    this.m_fixtureUnitUpdateComboBox.DropDownStyle = ComboBoxStyle.DropDown;
    this.m_fixtureUnitUpdateComboBox.ListenToPick = false;
    componentResourceManager.ApplyResources((object) this.m_fixtureUnitUpdateComboBox, "m_fixtureUnitUpdateComboBox");
    ((Control) this.m_fixtureUnitUpdateComboBox).Name = "m_fixtureUnitUpdateComboBox";
    this.m_fixtureUnitUpdateComboBox.Object = (ITxObject) null;
    this.m_fixtureUnitUpdateComboBox.PickLevel = (TxPickLevel) 1;
    this.m_fixtureUnitUpdateComboBox.ValidatorType = (TxValidatorType) 1;
    this.m_fixtureUnitUpdateComboBox.SelectionChanged += new EventHandler(this.m_fixtureUnitUpdateComboBox_SelectionChanged);
    this.m_fixtureUnitUpdateComboBox.TypeInvalid += new EventHandler(this.m_fixtureUnitUpdateComboBox_TypeInvalid);
    this.m_fixtureUnitUpdateComboBox.TypeValid += new EventHandler(this.m_fixtureUnitUpdateComboBox_TypeValid);
    ((Control) this.m_fixtureUnitUpdateComboBox).Leave += new EventHandler(this.m_fixtureUnitUpdateComboBox_Leave);
    this.m_fixtureUnitUpdateComboBox.Picked += new TxObjComboBoxCtrl_PickedEventHandler(this.m_fixtureUnitUpdateComboBox_Picked);
    ((Control) this.m_fixtureUnitUpdateComboBox).Enter += new EventHandler(this.m_fixtureUnitUpdateComboBox_Enter);
    this.m_targetResourceUpdateEditBox.ListenToPick = false;
    componentResourceManager.ApplyResources((object) this.m_targetResourceUpdateEditBox, "m_targetResourceUpdateEditBox");
    ((Control) this.m_targetResourceUpdateEditBox).Name = "m_targetResourceUpdateEditBox";
    this.m_targetResourceUpdateEditBox.Object = (ITxObject) null;
    this.m_targetResourceUpdateEditBox.PickLevel = (TxPickLevel) 1;
    this.m_targetResourceUpdateEditBox.ReadOnly = false;
    this.m_targetResourceUpdateEditBox.ValidatorType = (TxValidatorType) 1;
    this.m_targetResourceUpdateEditBox.TypeInvalid += new EventHandler(this.m_targetResourceUpdateEditBox_TypeInvalid);
    this.m_targetResourceUpdateEditBox.TypeValid += new EventHandler(this.m_targetResourceUpdateEditBox_TypeValid);
    this.m_targetResourceUpdateEditBox.Picked += new TxObjEditBoxCtrl_PickedEventHandler(this.m_targetResourceUpdateEditBox_Picked);
    componentResourceManager.ApplyResources((object) this.m_updateUnitButton, "m_updateUnitButton");
    this.m_updateUnitButton.Name = "m_updateUnitButton";
    this.m_updateUnitButton.UseVisualStyleBackColor = true;
    this.m_updateUnitButton.Click += new EventHandler(this.m_updateUnitButton_Click);
    componentResourceManager.ApplyResources((object) this.m_calculateButton, "m_calculateButton");
    this.m_calculateButton.Name = "m_calculateButton";
    this.m_calculateButton.UseVisualStyleBackColor = true;
    this.m_calculateButton.Click += new EventHandler(this.m_calculateButton_Click);
    componentResourceManager.ApplyResources((object) this.m_solutionsNumericUpDown, "m_solutionsNumericUpDown");
    this.m_solutionsNumericUpDown.Maximum = new Decimal(new int[4]
    {
      1000000,
      0,
      0,
      0
    });
    this.m_solutionsNumericUpDown.Name = "m_solutionsNumericUpDown";
    componentResourceManager.ApplyResources((object) this.m_solutionsNumberLabel, "m_solutionsNumberLabel");
    this.m_solutionsNumberLabel.Name = "m_solutionsNumberLabel";
    componentResourceManager.ApplyResources((object) this.m_fixtureBaseLabel, "m_fixtureBaseLabel");
    this.m_fixtureBaseLabel.Name = "m_fixtureBaseLabel";
    componentResourceManager.ApplyResources((object) this.m_targetResourceUpdateLabel, "m_targetResourceUpdateLabel");
    this.m_targetResourceUpdateLabel.Name = "m_targetResourceUpdateLabel";
    this.tabPage3.Controls.Add((Control) this.m_configurationReplaceEditBox);
    this.tabPage3.Controls.Add((Control) this.m_fixtureUnitReplaceEditBox);
    this.tabPage3.Controls.Add((Control) this.m_targetResourceReplaceEditBox);
    this.tabPage3.Controls.Add((Control) this.m_applyButton);
    this.tabPage3.Controls.Add((Control) this.m_configurationReplaceLabel);
    this.tabPage3.Controls.Add((Control) this.m_targetResourceReplaceLabel);
    this.tabPage3.Controls.Add((Control) this.m_fixtureUnitReplaceLabel);
    componentResourceManager.ApplyResources((object) this.tabPage3, "tabPage3");
    this.tabPage3.Name = "tabPage3";
    this.tabPage3.UseVisualStyleBackColor = true;
    this.m_configurationReplaceEditBox.ListenToPick = false;
    componentResourceManager.ApplyResources((object) this.m_configurationReplaceEditBox, "m_configurationReplaceEditBox");
    ((Control) this.m_configurationReplaceEditBox).Name = "m_configurationReplaceEditBox";
    this.m_configurationReplaceEditBox.Object = (ITxObject) null;
    this.m_configurationReplaceEditBox.PickLevel = (TxPickLevel) 1;
    this.m_configurationReplaceEditBox.ReadOnly = false;
    this.m_configurationReplaceEditBox.ValidatorType = (TxValidatorType) 1;
    this.m_configurationReplaceEditBox.TypeInvalid += new EventHandler(this.m_configurationReplaceEditBox_TypeInvalid);
    this.m_configurationReplaceEditBox.TypeValid += new EventHandler(this.m_configurationReplaceEditBox_TypeValid);
    this.m_configurationReplaceEditBox.Picked += new TxObjEditBoxCtrl_PickedEventHandler(this.m_configurationReplaceEditBox_Picked);
    this.m_fixtureUnitReplaceEditBox.ListenToPick = false;
    componentResourceManager.ApplyResources((object) this.m_fixtureUnitReplaceEditBox, "m_fixtureUnitReplaceEditBox");
    ((Control) this.m_fixtureUnitReplaceEditBox).Name = "m_fixtureUnitReplaceEditBox";
    this.m_fixtureUnitReplaceEditBox.Object = (ITxObject) null;
    this.m_fixtureUnitReplaceEditBox.PickLevel = (TxPickLevel) 1;
    this.m_fixtureUnitReplaceEditBox.ReadOnly = false;
    this.m_fixtureUnitReplaceEditBox.ValidatorType = (TxValidatorType) 1;
    this.m_fixtureUnitReplaceEditBox.TypeInvalid += new EventHandler(this.m_fixtureUnitReplaceEditBox_TypeInvalid);
    this.m_fixtureUnitReplaceEditBox.TypeValid += new EventHandler(this.m_fixtureUnitReplaceEditBox_TypeValid);
    this.m_fixtureUnitReplaceEditBox.Picked += new TxObjEditBoxCtrl_PickedEventHandler(this.m_fixtureUnitReplaceEditBox_Picked);
    this.m_targetResourceReplaceEditBox.ListenToPick = false;
    componentResourceManager.ApplyResources((object) this.m_targetResourceReplaceEditBox, "m_targetResourceReplaceEditBox");
    ((Control) this.m_targetResourceReplaceEditBox).Name = "m_targetResourceReplaceEditBox";
    this.m_targetResourceReplaceEditBox.Object = (ITxObject) null;
    this.m_targetResourceReplaceEditBox.PickLevel = (TxPickLevel) 1;
    this.m_targetResourceReplaceEditBox.ReadOnly = false;
    this.m_targetResourceReplaceEditBox.ValidatorType = (TxValidatorType) 1;
    this.m_targetResourceReplaceEditBox.TypeInvalid += new EventHandler(this.m_targetResourceReplaceEditBox_TypeInvalid);
    this.m_targetResourceReplaceEditBox.TypeValid += new EventHandler(this.m_targetResourceReplaceEditBox_TypeValid);
    this.m_targetResourceReplaceEditBox.Picked += new TxObjEditBoxCtrl_PickedEventHandler(this.m_targetResourceReplaceEditBox_Picked);
    componentResourceManager.ApplyResources((object) this.m_applyButton, "m_applyButton");
    this.m_applyButton.Name = "m_applyButton";
    this.m_applyButton.UseVisualStyleBackColor = true;
    this.m_applyButton.Click += new EventHandler(this.m_applyButton_Click);
    componentResourceManager.ApplyResources((object) this.m_configurationReplaceLabel, "m_configurationReplaceLabel");
    this.m_configurationReplaceLabel.Name = "m_configurationReplaceLabel";
    componentResourceManager.ApplyResources((object) this.m_targetResourceReplaceLabel, "m_targetResourceReplaceLabel");
    this.m_targetResourceReplaceLabel.Name = "m_targetResourceReplaceLabel";
    componentResourceManager.ApplyResources((object) this.m_fixtureUnitReplaceLabel, "m_fixtureUnitReplaceLabel");
    this.m_fixtureUnitReplaceLabel.Name = "m_fixtureUnitReplaceLabel";
    componentResourceManager.ApplyResources((object) this, "$this");
    ((ContainerControl) this).AutoScaleMode = AutoScaleMode.Font;
    ((Control) this).Controls.Add((Control) this.m_tabControl);
    ((Control) this).Controls.Add((Control) this.m_closeButton);
    ((Form) this).FormBorderStyle = FormBorderStyle.FixedDialog;
    ((Form) this).MaximizeBox = false;
    ((Control) this).Name = nameof (CUiMFFixtureDesignerApplicationDlg);
    this.SemiModal = false;
    ((Form) this).ShowIcon = false;
    ((Form) this).Load += new EventHandler(this.CUiFixtureDesignerApplicationDlg_Load);
    ((Form) this).FormClosing += new FormClosingEventHandler(this.CUiFixtureDesignerApplicationDlg_FormClosing);
    this.m_tabControl.ResumeLayout(false);
    this.tabPage1.ResumeLayout(false);
    this.tabPage1.PerformLayout();
    this.tabPage2.ResumeLayout(false);
    this.tabPage2.PerformLayout();
    this.m_solutionsNumericUpDown.EndInit();
    this.tabPage3.ResumeLayout(false);
    this.tabPage3.PerformLayout();
    ((Control) this).ResumeLayout(false);
  }
}
